home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Tools / Turbo Pascal V7 / TVFM.ZIP / MAKERES.PAS < prev    next >
Pascal/Delphi Source File  |  1992-11-03  |  15KB  |  450 lines

  1. {************************************************}
  2. {                                                }
  3. {   Turbo Vision File Manager Demo               }
  4. {   Copyright (c) 1992 by Borland International  }
  5. {                                                }
  6. {************************************************}
  7.  
  8. program MakeRes;  { Makes resource file for TVFM }
  9.  
  10. uses Dos, Objects, Drivers, App, Views, Menus, Dialogs, StdDlg,
  11.   Globals, Equ;
  12.  
  13.  
  14.  
  15. { ---------------  Generate Resources  ------------------ }
  16.  
  17. procedure MakeMenuBar;
  18. var
  19.   R: TRect;
  20.   M: PMenuBar;
  21. begin
  22.   R.Assign(0,0,80,1);
  23.   M := New(PMenuBar, Init(R, NewMenu(
  24.     NewSubMenu('~F~ile', hcFileMenu, NewMenu(
  25.       NewItem('~N~ew window...', 'F3', kbF3, cmNewWindow, hcNewWindow,
  26.       NewLine(
  27.       NewItem('~E~xecute file...', '', 0, cmExecute, hcExecute,
  28.       NewSubMenu('~V~iew', hcViewSubMenu, NewMenu(
  29.         NewItem('View as ~t~ext', 'Ctrl+F4', kbCtrlF4, cmViewAsText, hcViewAsText,
  30.         NewItem('View as ~h~ex', 'Alt+F4', kbAltF4, cmViewAsHex, hcViewAsHex,
  31.         NewItem('~C~ustom viewer', 'F4', kbF4, cmViewCustom, hcViewCustom,
  32.         nil)))),
  33.       NewLine(
  34.       NewItem('~A~ssociate...', '', 0, cmAssociate, hcAssociate,
  35.       NewItem('~C~opy...', 'F7', kbF7, cmCopy, hcCopy,
  36.       NewItem('~D~elete...', '', 0, cmDelete, hcDelete,
  37.       NewItem('~R~ename...', '', 0, cmRename, hcRename,
  38.       NewItem('Chan~g~e attr...', '', 0, cmChangeAttr, hcChangeAttr,
  39.       NewItem('~S~earch for files...', '', 0, cmBeginSearch, hcBeginSearch,
  40.       NewLine(
  41.       NewSubMenu('~T~ags', hcTagSubMenu, NewMenu(
  42.         NewItem('~R~everse all tags', '', 0, cmReverseTags, hcReverseTags,
  43.         NewItem('~C~lear tags', '', 0, cmClearTags, hcClearTags,
  44.         NewItem('Tag per ~w~ildcard...', '',0, cmTagPerCard, hcTagPerCard,
  45.         nil)))),
  46.       NewLine(
  47.       NewItem('R~u~n DOS command...', '', 0, cmRun, hcRun,
  48.       NewItem('D~O~S shell', '', 0, cmDosShell, hcDosShell,
  49.       NewLine(
  50.       NewItem('E~x~it', 'Alt-X', kbAltX, cmQuit, hcQuit,
  51.       NewItem('Exit to c~u~rrent dir', 'Alt-C', kbAltC, cmExitHere, hcExitHere,
  52.       nil)))))))))))))))))))),
  53.     NewSubMenu('~O~ptions', hcOptionsMenu, NewMenu(
  54.       NewItem('Toggle ~v~ideo mode', 'Alt-F10', kbAltF10, cmVideoMode, hcVideoMode,
  55.       NewItem('~I~nstall custom viewer...', '', 0, cmInstallViewer, hcInstallViewer,
  56.       NewItem('~D~isplay preferences...', '', 0, cmDisplayOptions, hcDisplayOptions,
  57.       NewItem('~C~hange colors', '', 0, cmColorChange, hcColorChange,
  58.       NewLine(
  59.       NewItem('~S~ave configuration', '', 0, cmSaveConfig, hcSaveConfig,
  60.       nil))))))),
  61.     NewSubMenu('~W~indows', hcWindowMenu, NewMenu(
  62.       StdWindowMenuItems(nil)
  63.       ),
  64.     nil))))));
  65.   RezFile.Put(M, 'MainMenu');
  66.   Dispose(M, Done);
  67. end;
  68.  
  69. procedure MakeStatusLine;
  70. var
  71.   R: TRect;
  72.   P: PView;
  73. begin
  74.   R.Assign(0, 24, 80, 25);
  75.   P := New(PHCStatusLine, Init(R,
  76.     NewStatusDef(0, 0,
  77.       NewStatusKey('~Alt-X~ Exit', kbAltX, cmQuit,
  78.       NewStatusKey('~F3~ New window', kbF3, cmNewWindow,
  79.       NewStatusKey('~F4~ View custom', kbF4, cmViewCustom,
  80.       NewStatusKey('~F7~ Copy', kbF7, cmCopy,
  81.       NewStatusKey('', kbAltF3, cmClose,
  82.       NewStatusKey('', kbDel, cmDelete,
  83.       NewStatusKey('', kbCtrlEnter, cmExecute,
  84.       NewStatusKey('', kbAltC, cmExitHere,
  85.       NewStatusKey('', kbF10, cmMenu,
  86.       NewStatusKey('', kbCtrlBack, cmClearTags,
  87.       nil)))))))))),
  88.     NewStatusDef(1, $FFFF,
  89.       NewStatusKey('~Alt-X~ Exit', kbAltX, cmQuit,
  90.       nil),
  91.     nil))));
  92.   RezFile.Put(P, 'StatusLine');
  93.   Dispose(P, Done);
  94. end;
  95.  
  96. procedure MakeStrings;
  97. var
  98.   P : PStrListMaker;
  99. begin
  100.   p := New(PStrListMaker, Init(16384,100));
  101.   with p^ do
  102.   begin
  103.     { menu hint strings }
  104.     Put(hcFileMenu, 'File related commands');
  105.     Put(hcNewWindow, 'Open a new file tree window');
  106.     Put(hcExecute,'Execute the highlighted file');
  107.     Put(hcViewSubMenu,'Commands to view highlighted file');
  108.     Put(hcViewAsText,'View highlighted file in a text window');
  109.     Put(hcViewAsHex,'View highlighted file in a hex window');
  110.     Put(hcViewCustom,'View highlighted file using your custom viewer');
  111.     Put(hcAssociate, 'Associate a program with highlighted file');
  112.     Put(hcCopy,'Copy highlighted or tagged files to another drive/dir');
  113.     Put(hcDelete,'Delete highlighted or tagged file(s)');
  114.     Put(hcRename,'Rename highlighted file');
  115.     Put(hcChangeAttr,'Change highlighted file''s attributes');
  116.     Put(hcBeginSearch,'Search for files matching a wildcard');
  117.     Put(hcTagSubMenu,'Commands to tag/untag files');
  118.     Put(hcReverseTags,'Reverse the tagged status of all files');
  119.     Put(hcClearTags,'Remove all tags from files');
  120.     Put(hcTagPerCard,'Tag files per a wildcard you specify');
  121.     Put(hcRun, 'Enter a DOS command to run');
  122.     Put(hcDosShell, 'Temporarily exit to the command processor');
  123.     Put(hcQuit, 'Exit this program');
  124.     Put(hcExitHere, 'Exit to the currently highlighted directory');
  125.  
  126.     Put(hcOptionsMenu,'Program options');
  127.     Put(hcVideoMode,'Toggle between 25 and 42/50 line mode (EGA or better)');
  128.     Put(hcInstallViewer,'Install your custom file viewer');
  129.     Put(hcDisplayOptions,'Set file display options');
  130.     Put(hcColorChange,'Select a new color palette');
  131.     Put(hcSaveConfig,'Save current configuration for future use');
  132.  
  133.     Put(hcWindowMenu, 'Standard window manipulation commands');
  134.     Put(hcTile,'Arrange all windows on desktop without overlap');
  135.     Put(hcCascade,'Arrange all windows by overlapping');
  136.     Put(hcCloseAll,'Close all open windows on desktop');
  137.     Put(hcResize,'Resize or move the current window');
  138.     Put(hcZoom,'Grow current window to cover desktop');
  139.     Put(hcNext,'Move focus to the next window on the desktop');
  140.     Put(hcPrev,'Move focus to the previous window on the desktop');
  141.     Put(hcClose,'Close the current window');
  142.  
  143.     Put(hcDisplayFields, 'This is a test of the help context');
  144.  
  145.     { other assorted program strings }
  146.     Put(sNoFiles, '<no files>');
  147.     Put(sPleaseWait, 'Please wait...');
  148.     Put(sSameNameErr, 'You may not use the same name!');
  149.     Put(sRenameErr, 'Error %d renaming file');
  150.     Put(sSetAttrErr, 'Error %d setting attributes on %s');
  151.     Put(sNoAssociation, '%s has no association.');
  152.     Put(sPressAnyKey, 'Press any key to return...');
  153.     Put(sExecErr, 'Error %d executing '#13'%s');
  154.     Put(sExecRetCode, 'An exit code of %d was returned');
  155.     Put(sNoViewerErr, 'No custom viewer set.');
  156.     Put(sInvokeErr, 'Error %d invoking %s');
  157.     Put(sNoDrivesErr, 'Unable to detect any valid drives!');
  158.     Put(sAccessErr, 'Error %d accessing %s');
  159.     Put(sFileIsReadOnly, '(File marked as Read-Only)');
  160.     Put(sDeleteErr, 'Error %d deleting %s');
  161.     Put(sDeleting, 'Deleting ');
  162.     Put(sReadAttrErr, 'Unable to read attributes from this file!');
  163.     Put(sCustomViewer, 'Custom Viewer');
  164.     Put(sPathAndName, 'Path and Filename');
  165.     Put(sCantLocateOnPath, 'Unable to locate file on path');
  166.     Put(sFileNotAnExe, '%s is not an executable file.');
  167.     Put(sWriteCfgErr, 'Error %d writing config file');
  168.     Put(sInvalidCfgErr, 'Invalid configuration file.');
  169.     Put(sReading, 'Reading ');
  170.     Put(sWriting, 'Writing ');
  171.     Put(sScanning, 'Scanning %s drive');
  172.     Put(sDelSingle, 'Delete this file?');
  173.     Put(sDelMult, 'Delete these files?');
  174.   end;
  175.  
  176.   RezFile.Put(P, 'Strings');
  177.   Dispose(P, Done);
  178. end;
  179.  
  180.  
  181. procedure MakeAboutBox;
  182. var
  183.   D: PDialog;
  184.   Control: PView;
  185.   R: TRect;
  186. begin
  187.   R.Assign(0, 0, 40, 11);
  188.   D := New(PDialog, Init(R, 'About'));
  189.   with D^ do
  190.   begin
  191.     Options := Options or ofCentered;
  192.  
  193.     R.Grow(-1, -1);
  194.     Dec(R.B.Y, 3);
  195.     Insert(New(PStaticText, Init(R,
  196.       #13 +
  197.       ^C'TV File Manager Demo'#13 +
  198.       #13 +
  199.       ^C'Copyright (c) 1992'#13 +
  200.       #13 +
  201.       ^C'Borland International')));
  202.  
  203.     R.Assign(15, 8, 25, 10);
  204.     Insert(New(PButton, Init(R, 'O~K', cmOk, bfDefault)));
  205.   end;
  206.   RezFile.Put(D, 'AboutBox');
  207.   Dispose(D, Done);
  208. end;
  209.  
  210. procedure MakeDeleteWhichDialog;
  211. var
  212.   D: PDialog;
  213.   R: TRect;
  214. begin
  215.   R.Assign(0,0,41,10);
  216.   D:=New(PDialog, Init(R, 'Delete Which?'));
  217.   with D^ do
  218.   begin
  219.     Options := Options or ofCentered;
  220.     R.Assign(2,2,38,4);
  221.     Insert(New(PStaticText, Init(R, 'Delete all Tagged files or just the Current file?')));
  222.     R.Assign(1,7,13,9);
  223.     Insert(New(PButton,Init(R, '~T~agged', cmYes, bfNormal)));
  224.     R.Move(13,0);
  225.     Insert(New(PButton,Init(R, 'C~u~rrent', cmNo, bfNormal)));
  226.     R.Move(13,0);
  227.     Insert(New(PButton,Init(R, '~C~ancel', cmCancel, bfNormal)));
  228.     SelectNext(False);
  229.   end;
  230.   RezFile.Put(D, 'DeleteWhich');
  231.   Dispose(D, Done);
  232. end;
  233.  
  234. procedure MakeConfirmDelDialog;
  235. var
  236.   D: PDialog;
  237.   R: TRect;
  238. begin
  239.   R.Assign(0,0,60,8);
  240.   D:=New(PDialog, Init(R, 'Confirm Deletion'));
  241.   with D^ do
  242.   begin
  243.     Options := Options or ofCentered;
  244.     R.Assign(2,2,58,4);
  245.     Insert(New(PParamText, Init(R, 'Please confirm deletion of: %s'#13'%s',2)));
  246.     R.Assign(32,5,44,7);
  247.     Insert(New(PButton,Init(R, '~Y~es', cmYes, bfNormal)));
  248.     R.Move(14,0);
  249.     Insert(New(PButton,Init(R, '~N~o', cmNo, bfNormal)));
  250.     SelectNext(False);
  251.   end;
  252.   RezFile.Put(D, 'ConfirmDelete');
  253.   Dispose(D, Done);
  254. end;
  255.  
  256.  
  257. procedure MakeDisplayPrefDialog;
  258. var
  259.   D: PDialog;
  260.   R: TRect;
  261.   P: PView;
  262. begin
  263.   R.Assign(0,0,43,20);
  264.   D := New(PDialog, Init(R, 'Display Preferences'));
  265.  
  266.   with D^ do
  267.   begin
  268.     Options := Options or ofCentered;
  269.     { file mask }
  270.     R.Assign(13,2,27,3);
  271.     P := New(PInputLine, Init(R, 12));
  272.     Insert(P);
  273.     R.Assign(2,2,12,3);
  274.     Insert(New(PLabel, Init(R, 'File ~M~ask', P)));
  275.  
  276.     R.Assign(2,4,26,5);
  277.     P := New(PCheckboxes, Init(R, NewSItem('Show ~H~idden/System',nil)));
  278.     Insert(P);
  279.  
  280.     { sort by }
  281.     R.Assign(2,7,17,11);
  282.     P := New(PRadioButtons, Init(R, NewSItem('~N~ame',
  283.                                     NewSItem('~E~xtension',
  284.                                     NewSItem('~S~ize',
  285.                                     NewSItem('~D~ate/Time',
  286.                                     nil))))));
  287.     Insert(P);
  288.     R.Assign(2,6,10,7);
  289.     Insert(New(PLabel, Init(R, 'Sort By', P)));
  290.  
  291.     { sort dir }
  292.     R.Assign(2,13,18,15);
  293.     P := New(PRadioButtons, Init(R, NewSItem('As~c~ending',
  294.                                     NewSItem('Descendin~g~',
  295.                                     nil))));
  296.     Insert(P);
  297.  
  298.     R.Assign(2,12,17,13);
  299.     Insert(New(PLabel, Init(R, 'Sort Direction', P)));
  300.  
  301.     { display case }
  302.     R.Assign(23,7,39,9);
  303.     P := New(PRadioButtons, Init(R, NewSItem('~L~ower Case',
  304.                                     NewSItem('~U~pper Case',
  305.                                     nil))));
  306.     Insert(P);
  307.     R.Assign(23,6,36,7);
  308.     Insert(New(PLabel, Init(R, 'Display Case', P)));
  309.  
  310.     { display fields }
  311.     R.Assign(23,11,39,15);
  312.     P := New(PCheckboxes, Init(R, NewSItem('S~i~ze',
  313.                                   NewSItem('D~a~te',
  314.                                   NewSItem('T~i~me',
  315.                                   NewSItem('A~t~tributes',
  316.                                   nil))))));
  317.     Insert(P);
  318.  
  319.     R.Assign(23,10,38,11);
  320.     Insert(New(PLabel, Init(R, 'Display Fields', P)));
  321.  
  322.     R.Assign(7,17,19,19);
  323.     Insert(New(PButton, Init(R, '~O~K', cmOK, bfDefault)));
  324.     R.Assign(22,17,34,19);
  325.     Insert(New(PButton, Init(R, '~C~ancel', cmCancel, bfNormal)));
  326.     SelectNext(False);
  327.   end;
  328.   RezFile.Put(D, 'DisplayPref');
  329.   Dispose(D, Done);
  330. end;
  331.  
  332. procedure MakeRunDialog;
  333. var
  334.   D: PDialog;
  335.   R: TRect;
  336.   P: PView;
  337. begin
  338.   R.Assign(0,0,70,7);
  339.   D := New(PDialog, Init(R, 'Run DOS Program'));
  340.   with D^ do
  341.   begin
  342.     Options := Options or ofCentered;
  343.     R.Assign(15,2,66,3);
  344.     P := New(PInputLine, Init(R, 255));
  345.     Insert(P);
  346.     R.Assign(1,2,15,3);
  347.     Insert(New(PLabel, Init(R, 'Command ~L~ine', P)));
  348.     R.Assign(66,2,69,3);
  349.     Insert(New(PHistory, Init(R, PInputLine(P), cmRun)));
  350.     R.Assign(30,4,43,6);
  351.     Insert(New(PButton, Init(R, '~O~K', cmOK, bfDefault)));
  352.     R.Move(14,0);
  353.     Insert(New(PButton, Init(R, '~C~ancel', cmCancel, bfNormal)));
  354.     SelectNext(False);
  355.   end;
  356.   RezFile.Put(D, 'RunDialog');
  357.   Dispose(D, Done);
  358. end;
  359.  
  360. procedure MakeCopyDialog;
  361. var
  362.   D: PDialog;
  363.   R: TRect;
  364.   P: PView;
  365. begin
  366.   R.Assign(0,0,60,7);
  367.   D:=New(PDialog, Init(R, 'Copy File(s)'));
  368.   with D^ do
  369.   begin
  370.     Options := Options or ofCentered;
  371.     R.Assign(14,2,56,3);
  372.     P := New(PInputLine, Init(R, 80));
  373.     Insert(P);
  374.     R.Assign(1,2,14,3);
  375.     Insert(New(PLabel, Init(R, '~D~estination', P)));
  376.     R.Assign(56,2,59,3);
  377.     Insert(New(PHistory, Init(R, PInputLine(P), cmCopy)));
  378.  
  379.     R.Assign(31,4,43,6);
  380.     Insert(New(PButton, Init(R, '~O~K', cmOK, bfDefault)));
  381.     R.Move(14,0);
  382.     Insert(New(PButton, Init(R, '~C~ancel', cmCancel, bfNormal)));
  383.     SelectNext(False);
  384.   end;
  385.   RezFile.Put(D, 'CopyDialog');
  386.   Dispose(D, Done);
  387. end;
  388.  
  389. procedure MakeSearchDialog;
  390. var
  391.   D: PDialog;
  392.   R: TRect;
  393.   P: PView;
  394. begin
  395.   R.Assign(0,0,50,8);
  396.   D := New(PDialog, Init(R, 'Search Criteria'));
  397.   with D^ do
  398.   begin
  399.     Options := Options or ofCentered;
  400.     R.Assign(20,2,34,3);
  401.     P := New(PInputLine, Init(R, 12));
  402.     Insert(P);
  403.     R.Assign(2,2,20,3);
  404.     Insert(New(PLabel, Init(R, '~F~ile mask', P)));
  405.     R.Assign(20,3,48,4);
  406.     P := New(PInputLine, Init(R, SizeOf(PathStr) - 1));
  407.     Insert(P);
  408.     R.Assign(2,3,20,4);
  409.     Insert(New(PLabel, Init(R, '~S~tarting from', P)));
  410.     R.Assign(10,5,20,7);
  411.     Insert(New(PButton, Init(R, '~B~egin', cmOK, bfDefault)));
  412.     R.Move(14,0);
  413.     Insert(New(PButton, Init(R, '~C~ancel', cmCancel, bfNormal)));
  414.     SelectNext(False);
  415.   end;
  416.   RezFile.Put(D, 'SearchDialog');
  417.   Dispose(D, Done);
  418. end;
  419.  
  420.  
  421.  
  422. begin
  423.   Writeln('Resource File Maker for TVFM.PAS,  version 1.0');
  424.   Writeln;
  425.  
  426.   RezStream := New(PProtectedStream, Init('TVFM.TVR', stCreate, 4096));
  427.   RezFile.Init(RezStream);
  428.  
  429.   RegisterObjects;  { registers TStringCollection }
  430.   RegisterViews;
  431.   RegisterMenus;
  432.   RegisterDialogs;
  433.   RegisterStdDlg;
  434.  
  435.   RegisterGlobals;
  436.   RegisterType(RStrListMaker);
  437.  
  438.   MakeMenuBar;
  439.   MakeStatusLine;
  440.   MakeStrings;
  441.   MakeAboutBox;
  442.   MakeDeleteWhichDialog;
  443.   MakeConfirmDelDialog;
  444.   MakeDisplayPrefDialog;
  445.   MakeRunDialog;
  446.   MakeCopyDialog;
  447.   MakeSearchDialog;
  448.   RezFile.Done;
  449. end.
  450.